package net.zoneland.knowledge.controller.util;

import net.zoneland.knowledge.enums.CompanyEnum;
import net.zoneland.knowledge.model.PartyOrgVoForSelect;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 第二级组织树.
 * @author zx
 */
public final class PartyOrgTreeUtils {

    private static List<PartyOrgVoForSelect> list  = Collections.unmodifiableList(
                CompanyEnum.getCompanyEnums().stream().map(item -> {
                    final PartyOrgVoForSelect partyOrgVoForSelect = new PartyOrgVoForSelect();
                    partyOrgVoForSelect.setOrgUUID(item.getOrgUuid());
                    partyOrgVoForSelect.setOrgShortName(item.getAliasName());
                    partyOrgVoForSelect.setLeaf(false);//是否叶子节点
                    return partyOrgVoForSelect;
                }).collect(Collectors.toList()));

    public static List<PartyOrgVoForSelect> getPartyOrgVoForSelectList() {
        return list;
    }
}
